/*
 * Copyright (C) 2012 Tomas Shestakov. <http://code.google.com/p/jmmo/>
 */

package jmmo.engine.property

/**
 * Object extended this trait provide `id` method for self identification.
 */
trait Identifiable {

  /**
   * @return identifier of object. Often it is a String or Symbol.
   * For best performance it is recommend to use immutable objects as Ids.
   */
  def id: Identifier
}

trait NoneIdentifiable extends Identifiable {

  /**
   * @return None.
   */
  def id = Identifier.empty
}

object Identifiable {

  /**
   * Type of identifiable filter.
   */
  type Filter = (Identifiable) => Boolean

  /**
   * Filter which pass all identifiables
   */
  val passAll: Filter = _ => true
}